import java.sql.Array;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-08-14
 * Time: 13:26
 */
public class August14th {
    public static void main(String[] args) {
/*        int[] array={1,2,3,4,5,6};
        arraySwap(array);
        System.out.println(Arrays.toString(array));*/

/*        int[] array={2,4,3,7};
        System.out.println(Arrays.toString(twoSum(array,10)));*/

        /*int[] array={1,2,3,2,1,3,5};
        System.out.println(onlyone(array));*/

/*        int[] array={4,5,3,3,4,4,4,9,4};
        Arrays.sort(array);
        System.out.println(array[array.length/2]);*/

        int[] array={1,2,3,2,7,8};
        System.out.println(three(array));
    }
    public  static boolean three(int[] array){
        int count=0;
        for (int i = 0; i < array.length; i++) {
            if(array[i]%2!=0){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                return true;
            }
        }
        return false;
    }
















    public  static int onlyone(int[] array){
        int num=array[0];
        for (int i = 1; i < array.length; i++) {
            num^=array[i];
        }
        return num;
    }







    public  static int[] twoSum(int[] array,int target){
        int[] ret=new int[]{-1,-1};
     for (int i = 0; i < array.length-2; i++) {
         for (int j =i+1; j < array.length-1; j++) {
             if(array[j]+array[j+1]==target){
                 ret[0]=j;
                 ret[1]=j+1;
                 return ret;
             }
         }
     }
     return ret;
 }



    public  static void arraySwap(int[] array){
        int left=0;
        int right= array.length-1;

        while(left<right){
            while(array[left]%2!=0){
                left++;
            }
            while(array[right]%2==0){
                right--;
            }
            if(left<right){
                int temp=0;
                temp=array[left];
                array[left]=array[right];
                array[right]=temp;
            }
        }
    }
}
